(function () {
    let template = function (self) {
        return self.innerHTML;
    };

    document.auiDefineElement(
        'aux-dialog',
        {
            template,
            attached(self) {
                self.$locked = false;
                self.show = function() {
                    self.auiToggleAttribute("open", "open");
                }
                self.hide = function() {
                    self.auiToggleAttribute("open", "open");
                }
                self.toggle = function() {
                    self.auiToggleAttribute("open", "open");
                }
            }
        }
    );

    document.auiDefineElement(
        'aux-dialog-trigger',
        {
            template: function (self) {
                return self.innerHTML;
            },
            props: {
                
            },
            attached(self) {
                self.$locked = false;
                self.addEventListener("click", function() {
                    console.log(self.getAttribute("for"));
                    var dialog = document.getElementById(self.getAttribute("for"));
                    if (dialog) {
                        dialog.show();
                    }
                });
            }
        }
    );
})();
